package com.weilus.dao;

import com.weilus.entity.TT;
import org.springframework.data.domain.Pageable;
import org.springframework.data.r2dbc.repository.Modifying;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;


@Repository
public interface TTRepository extends R2dbcRepository<TT, Long> {

    Flux<TT> findByIdGreaterThan(Long id,Pageable pageable);

    Mono<Long> countByIdGreaterThan(Long id);

    Flux<TT> findAllBy(Pageable pageable);

    @Modifying
    @Query("UPDATE t_t SET name=:name,update_time=NOW() WHERE id=:id")
    Mono<Long> updateName(@Param("id")Long id, @Param("name")String name);


}
